#include"csapp.h"  
  
void mmapcopy(int fd,int fd1,int size){  
    char *bufp;  
    bufp =(char *)mmap(NULL,size,PROT_READ,MAP_PRIVATE,fd,0); 
    write(1,bufp,size);
    munmap(bufp,size);
    return;  
}  
  
int main(int argc,char **argv){  
    struct stat _stat; 
    int fd,fd1;  
    if(argc != 2){  
        printf("usage :%s <filename>",argv[0]);  
        exit(0);  
    }  
    fd = open(argv[1],O_RDONLY,0);  
    fstat(fd,&_stat);
    mmapcopy(fd,fd1,_stat.st_size);  
  
    return 0;  
}  
